<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="div1">
        <p id="p1">点击我</p>
        <p id="p2">点击我</p>
    </div>
</body>
<script>
    let p1 = document.querySelector("#p1");
    let p2 = document.querySelector("#p2");

    let div1 = document.querySelector("#div1");
    div1.addEventListener("click",function(e) {
        let target = e.target;
        if (p1 == target) {
            console.log("我点击了p1")
        } else if (p2 == target) {
            console.log("我点击了p2")
        }
    })
</script>
</html>